
# RoseMary API methods

**API url structure**
```
http://{ip}:{port}/api/v1.0/
```

## getPlugins

**Status:** ✅

Return list of plugins from ~/.config/rosemary/plugins dir.

**!** *true/false in params mean required or optional parameter.* 

**Plugin format**
```json
{
    "category": "Invidious",
    "id": 0,
    "name": "[+] Invidious: Search",
    "query_description": "",
    "params": {
        "query": true
    }
}
```

**Request structure**
```
http://{ip}:{port}/api/v1.0/getPlugins
```

**Request example**
```
http://127.0.0.1:5000/api/v1.0/getPlugins
```

**Response example**
```json
[
  {
    "category": "SovetRomantica",
    "id": 0,
    "name": "[+] SovetRomantica: Ongoings",
    "query_description": "",
    "params": {}
  },
  {
    "category": "Invidious",
    "id": 1,
    "name": "[+] Invidious: Popular",
    "query_description": "",
    "params": {}
  },
  {
    "category": "AnilibriaTV",
    "id": 2,
    "name": "[+] AnilibriaTV: Random anime",
    "query_description": "",
    "params": {}
  }
]
```

## getPluginItems

Return list of plugin items by plugin id. 

**Status:** ✅

**Attention:** plugins return absolutly different items with different params. 

**Arguments**
```
params: OPTIONAL. Request params, contains query, instance_url and another options.
```

**Request structure**
```
http://{ip}:{port}/api/v1.0/getPluginItems/{id}?params={params}
```

**Request example**
```
http://127.0.0.1:5000/api/v1.0/getPluginItems/0?params={"query":+"test"}
```

**Response example**
```json
[
  {
    "author": "LaLa",
    "authorId": "UCz_tFd5vwjuiYIR38IoHzOw",
    "authorUrl": "/channel/UCz_tFd5vwjuiYIR38IoHzOw",
    "description": "",
    "descriptionHtml": "",
    "isUpcoming": false,
    "isWatched": false,
    "lengthSeconds": 113,
    "liveNow": false,
    "premium": false,
    "published": 1674802601,
    "publishedText": "4 months ago",
    "title": "Goylz & Urgamal - Test",
    "type": "video",
    "url": "https://iv.melmac.space/watch?v=MX9aKg7mv1U",
    "videoId": "MX9aKg7mv1U",
    "videoThumbnails": [
      {
        "height": 720,
        "quality": "maxres",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/maxres.jpg",
        "width": 1280
      },
      {
        "height": 720,
        "quality": "maxresdefault",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/maxresdefault.jpg",
        "width": 1280
      },
      {
        "height": 480,
        "quality": "sddefault",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/sddefault.jpg",
        "width": 640
      },
      {
        "height": 360,
        "quality": "high",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/hqdefault.jpg",
        "width": 480
      },
      {
        "height": 180,
        "quality": "medium",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/mqdefault.jpg",
        "width": 320
      },
      {
        "height": 90,
        "quality": "default",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/default.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "start",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/1.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "middle",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/2.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "end",
        "url": "https://iv.wirplusx.de/vi/MX9aKg7mv1U/3.jpg",
        "width": 120
      }
    ],
    "viewCount": 42722,
    "watched_time": 0
  },
  {
    "author": "Mihdens",
    "authorId": "UCZm-kThz415-1HG9LUP0HQg",
    "authorUrl": "/channel/UCZm-kThz415-1HG9LUP0HQg",
    "description": "",
    "descriptionHtml": "",
    "isUpcoming": false,
    "isWatched": false,
    "lengthSeconds": 13,
    "liveNow": false,
    "premium": false,
    "published": 1677481001,
    "publishedText": "2 months ago",
    "title": "Did I pass the test? #shorts",
    "type": "video",
    "url": "https://iv.melmac.space/watch?v=l7V5aXK5Ya4",
    "videoId": "l7V5aXK5Ya4",
    "videoThumbnails": [
      {
        "height": 720,
        "quality": "maxres",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/maxres.jpg",
        "width": 1280
      },
      {
        "height": 720,
        "quality": "maxresdefault",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/maxresdefault.jpg",
        "width": 1280
      },
      {
        "height": 480,
        "quality": "sddefault",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/sddefault.jpg",
        "width": 640
      },
      {
        "height": 360,
        "quality": "high",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/hqdefault.jpg",
        "width": 480
      },
      {
        "height": 180,
        "quality": "medium",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/mqdefault.jpg",
        "width": 320
      },
      {
        "height": 90,
        "quality": "default",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/default.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "start",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/1.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "middle",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/2.jpg",
        "width": 120
      },
      {
        "height": 90,
        "quality": "end",
        "url": "https://iv.wirplusx.de/vi/l7V5aXK5Ya4/3.jpg",
        "width": 120
      }
    ],
    "viewCount": 58021016,
    "watched_time": 0
  }
]
```


